/**
 * Created by Administrator on 2017/1/7.
 */
var should = require('should');
var Sample = require('../models/sample.js');

suite('sample-demo-unit-tests',function () {
    test('.getChapters(callback)', function (done) {
        var sample = new Sample('演示', 'Demo');
        should.equal(sample, '演示');
        should.equal(sample.name, '演示');
        should.equal(sample.path, 'D:\\Projects\\CSharp Projects\\Demo');

        sample.getChapters(getChaptersCallback);

        function getChaptersCallback(err, chapters) {
            if (err) {
                done(err);
            } else {
                should.equal(chapters.length, 15);

                var expected = [
                    'AjaxServerControlDemo',
                    'ConsoleApplicationDemo',
                    'Demo.sln',
                    'Demo.suo',
                    'Demo.v11.suo',
                    'Demo.v12.suo',
                    'packages',
                    'ServerControlDemo',
                    'TestResults',
                    'UnitTestProjectDemo',
                    'VisualBasicConsoleApplicationDemo',
                    'WcfServiceLibraryDemo',
                    'WebApplicationDemo',
                    'WindowsFormsApplicationDemo',
                    'WpfApplicationDemo'
                ];
                should.deepEqual(chapters, expected, 'all demo files');

                done();
            }
        }
    });
});